import {
    ElButton,
    ElUpload,
    ElIcon,
    ElImage,
    ElImageViewer,
    ElSpace,
    ElForm,
    ElFormItem,
    ElRow,
    ElCol,
    ElInput,
    ElEmpty,
} from "element-plus";

class Components {
    static _instance: any = null;
    static renderInstance() {
        if (!Components._instance) Components._instance = new Components();
        return Components._instance;
    }

    globalRegister(app, ...rest) {
        app.use(ElButton, ElButton.name);
        app.use(ElUpload, ElUpload.name);
        app.use(ElIcon, ElIcon.name);
        app.use(ElImage, ElImage.name);
        app.use(ElImageViewer, ElImageViewer.name);
        app.use(ElSpace, ElSpace.name);
        app.use(ElForm, ElForm.name);
        app.use(ElFormItem, ElFormItem.name);
        app.use(ElRow, ElRow.name);
        app.use(ElCol, ElCol.name);
        app.use(ElInput, ElInput.name);
        app.use(ElEmpty, ElEmpty.name);

        if (rest.length)
            rest.some((item) => {
                app.use(item, item.name);
            });
    }
}

export default Components.renderInstance();
